home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FWAVCDriver.h
-
- Contains: Definitions for FWAVCDriver.
-
- Written by: Erik Staats
-
- Copyright: © 1996-1997 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <FW16> 3/10/97 ES Added defs for maximum DCL size and NTSC frame rates.
- <FW15> 3/10/97 ES Changed to remove empty packets to resynchronize after lost
- cycles. Changed to loop over one frame on playback instead of
- three. Changed to play at a settable frame rate (29.97 Hz in
- header) with settable buffer group sizes. Improved memory
- allocation for playback.
- <FW14> 3/3/97 ES Added totalPlayPackets to FWAVCDriverData record and
- pFrameDCLTimeStamp to FWAVCFrameData record.
- <FW13> 1/16/97 ES Added use of DCLUpdateList commands.
- <FW12> 1/1/97 ES Added defs to add UpdateDCLList command to record DCL program.
- <FW11> 8/26/96 ES Changed to new command object interface.
- <FW10> 8/26/96 ES Added localFWReferenceID to FWAVCDriverData record.
- <FW9> 8/19/96 ES Replaced fwIsochChannelRequestParams with
- fwStopIsochChannelParams and fwStartIsochChennelParams in
- FWAVCDriverData record.
- <FW8> 8/16/96 ES Added pFWAllocateIsochPortParams to FWAVCDriverData record.
- <FW7> 8/15/96 ES Added stuff to make isoch channel and port stuff asynchronous
- and to support overrun handling to DV output.
- <FW6> 8/2/96 ES Updated for more isochronous changes.
- <FW5> 7/31/96 ES Changed to use new isochronous buffer architecture.
- <FW4> 7/8/96 ES Added stuff for dump and 3 frame snap shot loop playing
- capabilities.
- <FW3> 6/20/96 ES Made this look more like a .i generated interface.
- <FW2> 6/20/96 ES Filled in contains and written by fields.
- <FW1> 6/20/96 ES first checked in
-
- */
-
- #ifndef __FWAVCDRIVER__
- #define __FWAVCDRIVER__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #ifndef __FIREWIRE__
- #include <FireWire.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- enum
- {
- kDCLCommandPoolBlockSize = 1024
- };
-
- enum
- {
- kNTSCFrameRateNumerator = 2997,
- kNTSCFrameRateDenominator = 100
- };
-
- enum
- {
- kPlayFrameRateNumerator = kNTSCFrameRateNumerator,
- kPlayFrameRateDenominator = kNTSCFrameRateDenominator,
-
- kPlayFramePeriodNumerator = kPlayFrameRateDenominator,
- kPlayFramePeriodDenominator = kPlayFrameRateNumerator,
-
- kNumPlayBufferGroups = 3,
- kNumDataPacketsPerPlayBufferGroup = 80,
- kNumDataPacketsPerDVFrame = 250,
-
- kPlaySYTDelay = 3,
-
- kDVPacketDataSize = 480,
- kDVPacketCIPSize = 8
- };
-
- enum
- {
- kNumDVPacketsPerFrame = 250,
- kNumDVPaddingPacketsPerFrame = 30,
- kDVPacketSize = 488,
- kMinDVFrameSize =
- (kNumDVPacketsPerFrame + kNumDVPaddingPacketsPerFrame) * kDVPacketSize
- };
-
- enum
- {
- kNumPingPongs = 2,
- kNumPacketsPerPingPong = 10,
- kNumDCLsPerPingPongPacket = 1,
- kRecordNumDCLs =
- kNumPingPongs * kNumPacketsPerPingPong * kNumDCLsPerPingPongPacket,
- kMaxDCLSize = 32,
- kRecordDCLProgramSize = kMaxDCLSize * kRecordNumDCLs,
- kReceiveDVPacketSize = 492,
- kPingPongBufferSize =
- kNumPingPongs * kNumPacketsPerPingPong * kReceiveDVPacketSize
- };
-
- typedef struct FWAVCDVPingPongDataStruct
- FWAVCDVPingPongData,
- *FWAVCDVPingPongDataPtr;
-
- typedef struct FWAVCPlayBufferGroupDataStruct
- FWAVCPlayBufferGroupData,
- *FWAVCPlayBufferGroupDataPtr;
-
- typedef struct DCLCommandBlockStruct
- DCLCommandBlock,
- *DCLCommandBlockPtr;
-
- typedef struct DCLCommandPoolStruct
- DCLCommandPool,
- *DCLCommandPoolPtr;
-
- struct FWAVCDriverDataStruct
- {
- FWReferenceID localFWReferenceID; // Reference to local node.
- FWDriverID fwDriverID; // Our driver ID.
- CSRROMEntryID csrUnitID; // Out unit directory ID.
-
- Boolean channelInitialized; // True if channel has been initialized.
- IsochPortID isochPortID; // Local isochronous port ID.
- UInt32 isochChannelNum; // Above isochronous channel nubmer.
-
- IsochChannelID playIsochChannelID; // ID of isochronous channel allocated
- // for playing to camera.
- DCLProgramID playDCLProgramID; // ID of DCL program for playing.
- FWAVCPlayBufferGroupDataPtr pFWAVCPlayBufferGroupDataList; // List of buffer group data records.
- Ptr transmitBuffers; // Buffer to use for transmit packet data.
- DCLCommandPoolPtr pPlayDCLCommandPool; // Pool of DCL commands for playing.
- DCLCommandPtr playDCLList; // DCLs used for playing.
- DCLLabelPtr pUnderrunDCLLabel; // Pointer to underrun label.
- UInt32 totalPlayPackets; // Total number of packets for playing.
- UInt32 activePlayPackets; // Total number of active packets for playing.
- UInt32 nominalFrameCycleTime; // Nominal cycle time between frames.
- UInt32 sytNumerator; // Numerator of fractional syt.
- UInt32 nextSYT; // Next SYT to use on frame boundary.
- UInt32 nextDBC; // Next DBC to use for first packet of next buffer group.
- UInt32 nextDataPacketNum; // Data packet number for first data packet of next buffer group.
- Boolean playSnapShotChannelInitialized; // True if above channel has been initialized.
-
- IsochChannelID recordIsochChannelID; // ID of isochronous channel allocated
- // for recording from camera.
- DCLProgramID recordDCLProgramID; // ID of DCL program for recording.
- DCLCommandPtr recordDCLList; // DCLs used for recording.
- DCLCommandPtr *recordUpdateDCLList; // DCL update list used for recording.
- Ptr imageBuffer; // Buffer to hold image in.
- AVTDumpParamsPtr pAVTDumpParams; // Pointer to current dump request.
-
- FWCommandObjectID isochChannelCommandObjectID, // Command object for sending isoch channel commands.
- stopIsochChannelCommandObjectID, // Command object for asynchronously stopping an isoch channel.
- startIsochChannelCommandObjectID; // Command object for asynchronously starting an isoch channel.
-
- FWCommandObjectID isochPortCommandObjectID, // Command object for sending isoch port commands.
- stopIsochPortCommandObjectID, // Command object for asynchronously stopping an isoch port.
- startIsochPortCommandObjectID; // Command object for asynchronously starting an isoch port.
-
- FWCommandObjectID fcpCommandObjectID; // FireWire command object for sending FCP commands.
- FWCommandObjectID asyncFCPCommandObjectID; // FireWire command object for sending FCP commands asynchronously.
-
- UInt32 fcpCommandFrame[10]; // Pre-allocate FCP command frame.
- };
- typedef struct FWAVCDriverDataStruct
- FWAVCDriverData,
- *FWAVCDriverDataPtr;
-
- struct FWAVCDVPingPongDataStruct
- {
- FWAVCDriverDataPtr pFWAVCDriverData;
- DCLCommandPtr pFirstDCLCommand;
- };
-
- struct FWAVCPlayBufferGroupDataStruct
- {
- FWAVCPlayBufferGroupDataPtr pPrevFWAVCPlayBufferGroupData, // Links to previous and next buffer group data records.
- pNextFWAVCPlayBufferGroupData;
-
- FWAVCDriverDataPtr pFWAVCDriverData; // AVC driver data.
-
- DCLJumpPtr pEndOfBufferGroupDCLJump; // Pointer to jump command to end of buffer group.
- DCLLabelPtr pEndOfBufferGroupDCLLabel; // Pointer to label command at end of buffer group.
- DCLJumpPtr pBufferGroupSkipEmptyPacketDCLJump; // Pointer to jump command to use to skip an empty packet.
- DCLLabelPtr pBufferGroupSkipEmptyPacketDCLLabel; // Label to jump to to skip an empty packet.
- DCLLabelPtr pBufferGroupDontSkipEmptyPacketDCLLabel; // Label to jump to to not skip an empty packet.
- DCLCallProcPtr pBufferGroupDCLCallProc; // Pointer to buffer group's call proc command.
- DCLTimeStampPtr pBufferGroupDCLTimeStamp; // Pointer to buffer group's time stamp command.
- DCLCommandPtr pFirstBufferGroupDCLCommand; // Pointer to first DCL command in buffer group.
- DCLCommandPtr pLastBufferGroupDCLCommand; // Pointer to last DCL command in buffer group.
-
- DCLCommandPtr timeStampUpdateDCLList; // DCL update list with just the buffer group's time stamp DCL.
- DCLCommandPtr *bufferGroupUpdateDCLList; // List of DCL commands that need updating for each run through buffer group.
- UInt32 updateListSize; // Number of DCL commands in above list.
-
- UInt32 numPackets; // Number of packets in this buffer group.
- Boolean needsUpdate; // True if we need to explicitly update DCL commands.
- Boolean skippingEmptyPacket; // True if pBufferGroupSkipEmptyPacketDCLJump is set to skip an empty packet.
- };
-
- struct DCLCommandBlockStruct
- {
- DCLCommandBlockPtr pNextDCLCommandBlock; // Pointer to next DCL command block.
- Ptr block; // Block of data for DCLs.
- UInt32 blockLevel; // Current allocation level of this block.
- };
-
- struct DCLCommandPoolStruct
- {
- DCLCommandBlockPtr pFirstDCLCommandBlock, // Pointers to first and last DCL command blocks.
- pLastDCLCommandBlock;
- };
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __FWAVCDRIVER__ */
-